package gold.digger;

import gold.vo.TreeNode;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by fanzhenyu02 on 2020/6/27.
 * common problem solver template.
 */
public class LC951 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public boolean flipEquiv(TreeNode root1, TreeNode root2) {
            if (null == root1 && null == root2) return true;
            if ((null != root1 && null == root2) || (null == root1 && null != root2)) return false;
            if (root1.val != root2.val) return false;

            return (flipEquiv(root1.left, root2.left) && flipEquiv(root1.right, root2.right)) ||
                    (flipEquiv(root1.right, root2.left) && flipEquiv(root1.left, root2.right));
        }
    }

    public void run() {
        Solution solution = new Solution();
        List<Integer> list = new ArrayList<>();
        System.out.println(solution.toString());
    }

    public static void main(String[] args) throws Exception {
        LC951 an = new LC951();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
